public class test01 {
    public static void main(String[] args) {
        String d1="123";
        String d2="13345";
        System.out.println(d1.compareTo(d2));
        d1.equals(d2);
        // boolean b = d1 == d2;
    }
    public int compareTo(String value ,String anotherString) {
        int len1 = value.length();
        int len2 = anotherString.length();
        int lim = Math.min(len1, len2);
        char v1[] = value.toCharArray();
        char v2[] = anotherString.toCharArray();

        int k = 0;
        while (k < lim) {
            char c1 = v1[k];
            char c2 = v2[k];
            if (c1 != c2) {
                return c1 - c2;
            }
            k++;
        }
        return len1 - len2;
    }
}
